package cn.itsource.autoconfiguration;

import cn.dev33.satoken.jwt.StpLogicJwtForStateless;
import cn.dev33.satoken.stp.StpLogic;
import cn.itsource.config.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

/**
 * @program fccar_tt
 * @Description
 * @Author TT
 * @Date 2024/09/09 13:26
 * @Version 1.0
 */
@Configuration
@Import(RedisSerialize.class)
public class AuthAtoConfig {
    @Bean
    public SaTokenConfigure getSaTokenConfigure(){
        return new SaTokenConfigure();
    }

    @Bean
    public StpLogic getStpLogicJwt() {
        //return new StpLogicJwtForSimple();
        return new StpLogicJwtForStateless();
    }

    @Bean
    public StpInterfaceImpl getStpInterfaceImpl(){
        return new StpInterfaceImpl();
    }

    @Bean
    public TokenInterceptor getTokenInterceptor(){
        return new TokenInterceptor();
    }

    @Bean
    public PasswordEncoder getPasswordEncoder(){
        return new BCryptPasswordEncoder();
    }
}
